package srjava.messages;

import java.io.IOException;
import java.io.StringReader;

public class Task extends TaskInfo {
	SrString task;

	public Task() {
		super();
		task = new SrString();
	}

	public Task(ServerInfo owner, int taskId, TaskStatus taskStatus,
			SrString result, SrString task) {
		super(owner, taskId, taskStatus, result);
		this.task = task;
	}
	
	public Task(TaskInfo taskInfo, SrString task) {
		super(taskInfo);
	}

	@Override
	public String serialize() {
		String pom = super.serialize() + task.serialize();
		return pom;
	}

	@Override
	public void deSerialize(StringReader s) throws IOException {
		super.deSerialize(s);
		task.deSerialize(s);
	}
	
	public TaskInfo getTaskInfo() {
		return new TaskInfo(this.owner,this.taskId,this.taskStatus,this.result);
	}

	public SrString getTask() {
		return task;
	}

	public void setTask(SrString task) {
		this.task = task;
	}

	public void setTaskInfo(TaskInfo tempInfo) {
		this.owner = tempInfo.getOwner();
		this.result = tempInfo.getResult();
		this.taskId = tempInfo.getTaskId();
		this.taskStatus = tempInfo.getTaskStatus();
	}

	
}
